#include "bullet.h"

Bullet::Bullet(Game *g, ControllableActor *owner_p) : Actor(g){
    owner = owner_p;
    alive = 1;
    reinit();
}

void Bullet::reinit(){
    x = owner->get_graph_x();
    y = owner->get_graph_y() - owner->get_h()/2;
    vy = -6;
}

void Bullet::move(){
    y += vy;
    if(y<0)
    {
        alive = 0;
    }
    if(!alive)
    {
        game->actor_manager->del(this);
    }
}

void Bullet::hit(Actor *a, int damage)
{
    game->actor_manager->del(this);
}
